home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 147 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.5 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: jodle@bix.com (jodle)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Give operator. a chance
  5. Date: 26 Jan 1996 09:36:51 PST
  6. Organization: BIX
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4easfd$puc@news2.delphi.com>
  9. References: <3102AD11.1663@et.se> <4e8g4t$aa3@hermes.synopsys.com>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 26 Jan 1996 15:37:17 GMT
  12. X-Newsreader: TIN [version 1.2 PL2]
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMQkRRky4NqrwXLNJAQFxHgH+MZFapycJKFzcfwBw80aCzCKFCANyMjwW
  15.     G6SYWykDoisbalEdsntPZr2Bct8Z9neRlSJwoArcxCbb2WW9SMOIFA==
  16.     =mMcI
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. Joe Buck (jbuck@Synopsys.COM) wrote:
  20. : Dan Holmsand <dan@et.se> writes:
  21. : >Is operator.() banned from the standards discussion?
  22.  
  23. : Yes, I suppose it is, but since you brought it up I'll discuss it anyway.
  24.  
  25. [text elided]
  26.  
  27. : I think that this rejection was a mistake, as the lack of operator dot
  28. : complicates the implementation of delegation (e.g. in classes that use a
  29. : reference-counted representation object where the representation object
  30. : has virtual functions).  I subscribe to the "write things once"
  31. : philosophy, and hate long lists like
  32.  
  33. I'm afraid there is something I don't understand about this approach.  For
  34. a nontrivial class, one in which you have a delegate pointer and other
  35. members, how would you propose the compiler discriminate between
  36. overloaded (delegative) member selection and the selection of actual
  37. members of the class?  This would become an issue as soon as a member
  38. function tries to access member data or a user of the class attempts to
  39. form a call to a member function.
  40.  
  41. Only one scheme is immediately apparent to me; use a two-step member
  42. selection candidate approach.  Whether actual or delegative members are
  43. given precedence in such a scheme, the approach would be incongruent and
  44. perhaps contradictory with how the language solves other problems.
  45.  
  46. The -> operator has the advantage that it signals the delegation property
  47. of the member selection when it's performed.  It's easy enough for the
  48. programmer to ignore that aspect when it's adventageous for him to do so. 
  49. It is also easy enough to identify that aspect when it is an issue.  "I
  50. know this identifier is a reference or an object but here is this pointer
  51. member selection operator being used so I know delegation is being used."
  52. ---
  53. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  54.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  55.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  56.